#include <iostream>
#include <queue>
using namespace std;
void solve()
{
	int n;
	cin>>n;
	queue<int> q;
	for(int i=1;i<=n;i++)
	{
		q.push(i);
	}
	
	while(q.size())
	{
		for(int i=0;i<2;i++)
		{
			q.push(q.front());
			q.pop();
		}
		cout<<q.front()<<' ';
		q.pop();
	}
	cout<<endl;
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}
	
	return 0;
}
